<html>
<head><meta charset="utf-8"><title>No code-completion when using the ash crate · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/No.20code-completion.20when.20using.20the.20ash.20crate.html">No code-completion when using the ash crate</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="184821379"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/No%20code-completion%20when%20using%20the%20ash%20crate/near/184821379" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Clemens Wasser <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/No.20code-completion.20when.20using.20the.20ash.20crate.html#184821379">(Jan 04 2020 at 21:59)</a>:</h4>
<p>Here is the Problem:</p>
<div class="codehilite"><pre><span></span>use ash::version::*;
use ash::*;

fn main() {
  let entry = Entry::new().unwrap(); // rust analyzer deduces the type correctly: ash::EntryCustom&lt;Arc&lt;DynamicLibrary&gt;&gt;
  let instance = entry.create_instance(&amp;vk::InstanceCreateInfo::builder(), None).unwrap(); // rust analyzer does not deduce any type: {unknown}
  // should be: ash::Instance
  // When I remove the &quot;.unwrap()&quot; He deduces it as: Result&lt;{unknown}, InstanceError&gt;
}
</pre></div>


<p>Here is the corresponding source in the ash crate:</p>
<div class="codehilite"><pre><span></span>pub trait EntryV1_0 {
    type Instance; // Here is Self::Instance, but rust-analyzer fails to identify it as this (I think, ... no idea -&gt; what do you think?)

//...

    unsafe fn create_instance(
        &amp;self,
        create_info: &amp;vk::InstanceCreateInfo,
        allocation_callbacks: Option&lt;&amp;vk::AllocationCallbacks&gt;,
    ) -&gt; Result&lt;Self::Instance, InstanceError&gt;; // rust-analyzer cannot deduce the Type: Self::Instance, which is up there ^^

//...

}
</pre></div>



<a name="184823168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/No%20code-completion%20when%20using%20the%20ash%20crate/near/184823168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremy Kolb <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/No.20code-completion.20when.20using.20the.20ash.20crate.html#184823168">(Jan 04 2020 at 22:54)</a>:</h4>
<p>Might be <a href="https://github.com/rust-analyzer/rust-analyzer/issues/2603" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/issues/2603">https://github.com/rust-analyzer/rust-analyzer/issues/2603</a></p>



<a name="184824348"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/No%20code-completion%20when%20using%20the%20ash%20crate/near/184824348" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/No.20code-completion.20when.20using.20the.20ash.20crate.html#184824348">(Jan 04 2020 at 23:31)</a>:</h4>
<p>Yes, probably that (or rather, another instance of <a href="https://github.com/rust-lang/chalk/issues/234" target="_blank" title="https://github.com/rust-lang/chalk/issues/234">rust-lang/chalk#234</a>)</p>



<a name="184920202"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/No%20code-completion%20when%20using%20the%20ash%20crate/near/184920202" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Clemens Wasser <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/No.20code-completion.20when.20using.20the.20ash.20crate.html#184920202">(Jan 06 2020 at 16:14)</a>:</h4>
<p>Thanks for pointing that out.</p>



<a name="184922202"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/No%20code-completion%20when%20using%20the%20ash%20crate/near/184922202" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Clemens Wasser <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/No.20code-completion.20when.20using.20the.20ash.20crate.html#184922202">(Jan 06 2020 at 16:35)</a>:</h4>
<p>It turns out, that rust-analyzer knows the "create_instance" function and "go-to-function" and "show-function-signature" / "parameters" (shift+ctrl+space) do work... ?</p>



<a name="184922361"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/No%20code-completion%20when%20using%20the%20ash%20crate/near/184922361" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/No.20code-completion.20when.20using.20the.20ash.20crate.html#184922361">(Jan 06 2020 at 16:37)</a>:</h4>
<p>When we fail at using types to solve goto definition, we use a heuristics which basically looks for a function with appropriate name</p>



<a name="184929420"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/No%20code-completion%20when%20using%20the%20ash%20crate/near/184929420" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Clemens Wasser <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/No.20code-completion.20when.20using.20the.20ash.20crate.html#184929420">(Jan 06 2020 at 17:57)</a>:</h4>
<blockquote>
<p>When we fail at using types to solve goto definition, we use a heuristics which basically looks for a function with appropriate name</p>
</blockquote>
<p>Thanks</p>



<a name="186426670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/No%20code-completion%20when%20using%20the%20ash%20crate/near/186426670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Clemens Wasser <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/No.20code-completion.20when.20using.20the.20ash.20crate.html#186426670">(Jan 23 2020 at 19:37)</a>:</h4>
<p>Somehow it now works... Thanks! :D</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>